package cn.fx.baseweb.config;

import cn.fx.framework.redis.MyRedisCacheManager;
import cn.fx.framework.redis.RedisInitialCacheHandler;
import cn.fx.framework.utils.New;
import org.springframework.data.redis.cache.RedisCacheConfiguration;

import java.util.Map;

/**
 * 当前应用初始化Redis缓存配置，与framework中MyRedisCacheManager中的缓存配置一起组成缓存配置组，为后面操作缓存读取配置用
 * @author ljh
 * @date 2018-08-22 10:02
 */
public class InitialRedisCache implements RedisInitialCacheHandler {
    @Override
    public Map<String, RedisCacheConfiguration> customCaches(String keyPrefix) {
        Map<String, RedisCacheConfiguration> map = New.map();
        //map.put(ShiroCache.SHIRO_CACHE_NAME,MyRedisCacheManager.defaultCacheConfig("ols:shiro"));
        map.put("menu", MyRedisCacheManager.defaultCacheConfig("keyPrefix"));
        ///map.put("dict", MyRedisCacheManager.defaultCacheConfig("ols:shiro").entryTtl(Duration.ofMinutes(12)));
        return map;
    }
}
